import os

def remove(f):
   print f
   os.remove(f)

for root, dirs, files in os.walk('.'):
   for f in files:
      for ext in ('~', '.pyc', '.cover', '.coverage', '.pyo', '.py.bak'):
         if f.endswith(ext):
            remove (os.path.join(root, f))
